<?php
namespace app\admin\validate;
use think\facade\Db;
use think\Validate;

class Lists extends Validate
{

    protected $rule=[
        'id'    =>'require',
        'cate_id'    =>'require',
        'type'    =>'require',
        'title'    =>'require',
        'img_url'    =>'require',
        'price'    =>'require',
        'duration'    =>'require',
        'effective_date'    =>'require',
        'sign_up_num'    =>'require',
        'content'    =>'require',
        'content_two'    =>'require',
    ];
    protected $message = [
        'id.require'    => '关键参数不能为空',
        'cate_id.require'    => '分类ID不能为空',
        'type.require'    => 'type关键参数不能为空',
        'title.require'    => '标题不能为空',
        //'img_url.unique'     => '已存在相同角色名称',
        'img_url.require'               =>'图片不能为空',
        'price.require'               =>'培训价格不能为空',
        'duration.require'               =>'培训时长不能为空',
        'effective_date.require'               =>'有效日期不能为空',
        'sign_up_num.require'               =>'已报名人数为空',
        'content.require'               =>'培训介绍不能为空',
        'content_two.require'               =>'报名须知不能为空',
    ];
    protected $scene = [
        'add' =>['title','cate_id','img_url','sign_up_num','content'],
        'edit'=>['id','cate_id','title','img_url','sign_up_num','content'],
        'del' =>['id'],
    ];

}